import require from '@/utils/_require';
const API = {
  'CATEGORY1': '/admin/product/getCategory1',
  'CATEGORY2': '/admin/product/getCategory2',
  'CATEGORY3': '/admin/product/getCategory3',
  'CATEGORY3': '/admin/product/getCategory3',
  'ATTRINFOLIST': '/admin/product/attrInfoList',
  'SAVEATTRINFO': '/admin/product/saveAttrInfo',
  'DELETEATTRINFO': '/admin/product/deleteAttr',
}

// 请求一级分类接口
export const reqCategory1 = function () {
  return require({
    url: API.CATEGORY1,
    method: 'get'
  })
}

// 请求二级分类接口
export const reqCategory2 = function (id) {
  return require({
    url: API.CATEGORY2 + `/${id}`,
    method: 'get'
  })
}

// 请求三级分类接口
export const reqCategory3 = function (id) {
  return require({
    url: API.CATEGORY3 + `/${id}`,
    method: 'get'
  })
}

// 请求attr信息列表
export const reqAttrInfoList = function (c1Id, c2Id, c3Id) {
  return require({
    url: API.ATTRINFOLIST + `/${c1Id}/${c2Id}/${c3Id}`,
    method: 'get'
  })
}

// 请求保存attr信息
export const reqSaveAttrInfo = function (data) {
  return require({
    url: API.SAVEATTRINFO,
    method: 'post',
    data
  })
}

// 请求保存attr信息
export const reqDeleteAttrInfo = function (attrId) {
  return require({
    url: API.DELETEATTRINFO + `/${attrId}`,
    method: 'delete',
  })
}